#pragma once

/*
	A region represents a cell on the worldspace map.
*/

#include "../Math/Vec2i.h"
#include <string>
#include <memory>
#include <vector>

template<class T>
struct Vector2d
{
	typedef std::vector<std::vector<T>> Type;
};

namespace World
{
	class RegionCell;
	typedef std::shared_ptr<RegionCell> RegionCellPtr;

	class RegionData
	{
	public:
		int seed;
		std::string name;

		//The edge falloff represents the distance from the edge border
		//where the region influence reaches 100%. For example trees will
		//grow more and more scattered the closer one comes the edge of the
		//region. This is a function of the difference between bordering
		//region biomes at world generation.
		int edgeFalloff;

		Vec2i topLeftCell;
		Vec2i bottomRightCell;
		Vec2i nbCells;
		Vector2d<RegionCellPtr> cells;
	};
	typedef std::unique_ptr<RegionData> RegionDataUPtr;

	class Region
	{
	public:
		Region();
		~Region();

		bool isGenerated() const { return (data != nullptr); }
		void generate(int seed);

	private:
		RegionDataUPtr data;
	};
}
